﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DailyComics.Common.Model.Storage
{
  public class CacheStorageStrategy : IStorageSetStrategy , IStorageGetStrategy
  {
    private Dictionary<string, IPersistable> cache;

    public CacheStorageStrategy(Dictionary<string, IPersistable> cache)
    {
      this.cache = cache;
    }

    #region IStorageSetStrategy Members

    public void Set(string name, IPersistable obj)
    {
      if (!cache.ContainsKey(name)) cache.Add(name, obj);
    }

    public void Set<T>(string name, T obj) where T : struct
    { }

    public void SetRange<T>(string name, IEnumerable<T> lst) where T : struct
    { }

    #endregion

    #region IStorageGetStrategy Members


    public IPersistable Get(string name)
    {
      throw new NotImplementedException();
    }

    public T Get<T>(string name) where T : struct
    {
      throw new NotImplementedException();
    }

    public IEnumerable<T> GetRange<T>(string name) where T : struct
    {
      throw new NotImplementedException();
    }

    #endregion
  }
}
